package com.yc.forum.servlet;

import com.yc.forum.dao.ReplyDao;
import com.yc.forum.util.Utils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//查询一条帖子下的所有评论的总数
@WebServlet(name="GetReplySumServlet",value = "/GetReplySumServlet.s")
public class GetReplySumServlet extends HttpServlet {
    ReplyDao replyDao=new ReplyDao();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String postId=req.getParameter("postId");
        int sum= replyDao.selectReplySum(postId);
        Utils.toJson(sum,resp);
    }
}
